TcaplusDB Client - Select Command Query Primary Key Indexes

For TcaplusDB Client Instructions, see Document.

1. Function Descriptions

Query the values of all or part of the fields of the whole data, according to the values of all the primary key fields of the data specified by the user. If there are no matching records, an error will be returned.

If you need to modify the records in the queried file and then update them to the server, use the load command.

Please note that for the List table, the load command will directly insert a new record. If you need to update the original record on the server, use the update command and specify the index.

Please note that the file name for saving query results cannot start with a number.

2. Initial Version

3.40.0

3. Command Syntax

select key1, key2, key3, value1, value2 [into result.csv] from table [where key1 = 1 and key2 = "abc" and key3=1] [and -index = 1] [\P] [\G] [\S] [using tdr] [encode]
select * [into result.xml] from table [where key1 = 1 and key2 = "abc" and key3=1] [and -index = 1] using tdr [\P];

Parameter description:

Parameter PB Table TDR Table Required
table Table name Table name Yes
key Primary key field name. The values of all primary key fields must be specified Primary key field name. The values of all primary key fields must be specified Yes
value Non-primary key field name Non-primary key field name At least one or *
-index Generic table: not supported.
List table: if "-index" is specified, the index-th record under the same Key will be returned; if "-index" is not specified, all records under the same Key will be returned
Generic table: not supported.
List table: if "-index" is specified, the index-th record under the same Key will be returned; if "-index" is not specified, all records under the same Key will be returned
No
\P Print delay data Print delay data No
\G Vertical printing Vertical printing No
\S Read data from copy Read data from copy No. If not specified, it is the default to read data from the primary replica
\N Do not print field names Do not print field names No. If not specified, it is the default to print field names
\A Append query results to a file Append query results to a file No. If not specified, it is the default to overwrite the query results to a file
into Export data to file Export data to file No
using tdr Do not support If this parameter is required, it needs to specify the TDR file corresponding to the target table through the startup parameters at the time of starting the TcaplusDB Client. No
encode Not supported (carriage return or invisible characters have been preprocessed) After specifying this parameter, the dump command will encode the string type field value containing carriage return characters or invisible characters into BASE64 before outputting.
Note: This parameter takes effect only when it is specified using tdr
No

In addition to specifying the primary key in the where statement, versions after 3.55.0 also support the use of AND, combined with more flexible filter conditions. See Detailed Syntax.

4. Command Example

See Table Definition Example for table definition.

tcaplus> select * from test_table where gameid=1234 and itemid=12323 and name=testname;
+------+------+----------+------+----+-----+
|gameid|itemid|name      |typeid|Data|uname|
+------+------+----------+------+----+-----+
|1234  |12323 |"testname"|0     |9   |"ab" |
+------+------+----------+------+----+-----+
1 records selectd, select time: 9802 us

tcaplus> select uname from test_table where gameid=1234 and itemid=12323 and name=testname;
+------+------+----------+-----+
|gameid|itemid|name      |uname|
+------+------+----------+-----+
|1234  |12323 |"testname"|"ab" |
+------+------+----------+-----+
1 records selectd, select time: 9457 us

tcaplus> select * into test.csv from test_table where gameid=1234 and itemid=12323 and name=testname;
1 records are stored to test.csv, select time: 10198 us

tcaplus> select * from test_table where gameid=1234 and itemid=12323 and name=testname \P \G;
gameid: 1234
itemid: 12323
name: "testname"
typeid: 0
Data: 9
uname: "ab"

API ----      -1us    --->ProxyFront----      10us    --->ProxyEnd---     364us    --->SvrMainStart
|                              |                             |                           |381us
|11380us                       |4138us                       |4104us                   SvrWorkerStart
|                              |                             |                           |61us
API <---   34197us    ----ProxyFront<---      24us    ----ProxyEnd<--    3298us    ----SvrWorkerEnd
1 records selectd, select time: 11380 us


tcaplus> select * into table_list.xml from table_list where uin=99 and name = "99" and key1=99 using tdr;
11 records are stored to table_list.xml, select time: 135299 us

tcaplus> select c_string from table_list where uin=99 and name = "99" and key1=99;
+---+----+----+--------+
|uin|name|key1|c_string|
+---+----+----+--------+
|99 |"99"|99  |" "     |
+---+----+----+--------+
|99 |"99"|99  |""      |
+---+----+----+--------+
|99 |"99"|99  |""      |
+---+----+----+--------+
|99 |"99"|99  |""      |
+---+----+----+--------+
|99 |"99"|99  |""      |
+---+----+----+--------+
|99 |"99"|99  |" "     |
+---+----+----+--------+
|99 |"99"|99  |" "     |
+---+----+----+--------+
|99 |"99"|99  |" "     |
+---+----+----+--------+
|99 |"99"|99  |" "     |
+---+----+----+--------+
|99 |"99"|99  |" "     |
+---+----+----+--------+
|99 |"99"|99  |" "     |
+---+----+----+--------+
11 records selectd, select time: 102572 us

tcaplus> select c_string from table_list where uin=99 and name = "99" and key1=99 and -index=9;
+---+----+----+--------+
|uin|name|key1|c_string|
+---+----+----+--------+
|99 |"99"|99  |" "     |
+---+----+----+--------+
1 records selectd, select time: 9886 us

tcaplus> select * from table_list_bin where uin=1 and name="3" encode;
+------+---+------+-----+-----+-----+------+------+------------+------------+-------------+
|-index|uin|name  |level|count|items|name_1|name_2|binary_count|binary      |single_struct|
+------+---+------+-----+-----+-----+------+------+------------+------------+-------------+
|0     |1  |"Mw=="|1    |0    |0x   |""    |""    |5           |0x1232123443|0x           |
+------+---+------+-----+-----+-----+------+------+------------+------------+-------------+
|1     |1  |"Mw=="|1    |0    |0x   |""    |""    |5           |0x1232123443|0x           |
+------+---+------+-----+-----+-----+------+------+------------+------------+-------------+
2 records selected, select time: 4333 us

tcaplus> select * from table_list_bin where uin=1 and name="3";
+------+---+----+-----+-----+-----+------+------+------------+------------+-------------+
|-index|uin|name|level|count|items|name_1|name_2|binary_count|binary      |single_struct|
+------+---+----+-----+-----+-----+------+------+------------+------------+-------------+
|0     |1  |"3" |1    |0    |0x   |""    |""    |5           |0x1232123443|0x           |
+------+---+----+-----+-----+-----+------+------+------------+------------+-------------+
|1     |1  |"3" |1    |0    |0x   |""    |""    |5           |0x1232123443|0x           |
+------+---+----+-----+-----+-----+------+------+------------+------------+-------------+
2 records selected, select time: 4335 us

5. Common Errors

Refer to Common Errors.

[TDR Generic Table] [C++ SDK] Interface Description for Getting a Record.

[TDR Generic Table] [Java SDK] Interface Description for Getting a Record.

[TDR Generic Table] [Go SDK] Interface Description for Getting a Record.

[TDR List Table][C++ SDK] Interface Description for Getting A Record.

[TDR List Table][Java SDK] Interface Description for Getting A Record.

[TDR List Table][Go SDK] Interface Description for Getting A Record.

[PB Generic Table][C++ SDK] Interface Description for Getting A Record.

[PB Generic Table][Go SDK] Interface Description for Getting A Record.

[PB Generic Table][RESTFul API] Interface Description for Getting a Record.

[PB List Table][C++ SDK] Interface Description for Getting A Record.

[PB List Table][Go SDK] Interface Description for Getting A Record.

[PB List Table][RESTFul API] Interface Description for Getting A Record.

results matching ""

    No results matching ""